{extend name="/fool" /}
{block name="css"}
<style>
    .li{
        margin:20px;
    }
    .layui-input-inline input{
        width:50px;
    }
</style>
{/block}
{block name="menu_content"}
<form class="layui-form" action="" method="post">
    <ul id="content">
        <li class="li">
            待付款订单取消时间：拍下未付款订单
            <div class="layui-input-inline">
                <input type="text" name="qxtime" value="{$time['xs']}" maxlength="3" autocomplete="off" class="layui-input">
            </div>
            小时未付款，自动取消订单
        </li>
        <li class="li">
            待收货订单将于后台操作发货后
            <div class="layui-input-inline">
                <input type="text" name="sqtime" value="{$time['ts']}" maxlength="3" autocomplete="off" class="layui-input">
            </div>
            天，自动确认收货
        </li>
        <li class="li">
            <button type="submit" class="fh layui-btn">保存</button>
        </li>
    </ul>
</form>
<script>
</script>
<script>
    layui.use('upload', function(){
        var upload = layui.upload;
        //普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            ,url: "{:url('images')}"
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
                //上传成功
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
        //多图片上传
        upload.render({
            elem: '#test2'
            ,url: "{:url('images')}"
            ,multiple: true
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
                });
            }
            ,done: function(res){
                //上传完毕
            }
        });
    });
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    layui.use('layedit', function(){
        var layedit = layui.layedit;
        layedit.build('demo',{
            uploadImage:{}
        }); //建立编辑器
        layedit.set({
            uploadImage: {
                url: "{:url('images')}" //接口url
                ,type: 'post' //默认post
                ,done: function(res){
                    console.log(res);
                    //如果上传失败
                    if(res.code > 0){
                        return layer.msg('上传失败');
                    }
                    //上传成功
                }
            }
        });
        var layeditDemo= layedit.build('demo');
        $(" .layui-layedit .layui-unselect.layui-layedit-tool")
            .append('<i class="layui-icon layedit-tool-preview" title="预览"  style="font-size:18px"></i>');
        $(document).on('click','.layedit-tool-preview',function(data){
            parent.layer.open({
                title: '在线预览'
                , shade: 0.2
                ,move: false
                ,content: layedit.getContent(layeditDemo)
                ,offset: 'rt'
                ,area: ['1000px',(top.window.innerHeight*0.80 + 'px').toString()]
            });
        });
    });
    $(".listbu").click(function(){
        history.back(-1);
    })
</script>
{/block}